<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<jsp:include page="../common/easyui.jsp"></jsp:include>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/common.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/util.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/engine.js"></script>
	<script type='text/javascript' src="<%=request.getContextPath()%>/dwr/interface/OperDwr.js"></script>
<title></title>
	<script language="javascript">

	/**查询操作员信息 */
	function  serachQuery(){
		$("#tb").datagrid("load",{  
	 	"tjposoper.OperatorID": $("#operatorID").val(),
	 	"tjposoper.OperatorName": encodeURI($("#operatorName").val()) 			 
	 	 }); 
	}
	function msg(msg){
	 $.messager.show({
				 title:'系统提示',
				 msg:msg,
	 			 timeout:2000,
				 showType:'slide'
     			 });	
	}
	/** 增加操作员*/
	function goAddPage(){
			document.myform.action="operAction!toAddOper.action";
			document.myform.submit();
	}
	/**更改密码 */
	function editPwd(){
		var row = $("#tb").datagrid('getSelected');
		if(row == "" || row == null){
				msg("请选择需要修改密码的操作员");
				return false;
		}else{
				document.myform.action="<%=request.getContextPath()%>/jsp/oper/editPwd.jsp?operatorID="+row.operatorID;
				document.myform.submit();
		}
	}
	
	function editOper(){
		var row = $("#tb").datagrid('getSelected');
		if(row == "" || row == null){
				msg("请选择需要修改的操作员");
				return false;
		}else{
			$Eg("operatorID").value = row.operatorID;
			document.myform.action="operAction!beforeEditOper.action";
			document.myform.submit();
		}
	}

	function delOper(){
		var row = $("#tb").datagrid('getSelected');
		if(row == "" || row == null){
			msg("请选择一条记录");
			return false;
		}else{
			if(!confirm('确认注销？')){
				return true;
			};
		}
		OperDwr.delOper(row.operatorID,function(data){
			if(data=="") {
				msg("操作成功");
				serachQuery(1);
			}else {
				msg("操作失败："+data);
			}
		});
	}
</script>

</head>
	<body >
	 <div id="searchDiv" class="easyui-panel"  title="人员管理——查询提示" style="background-color:#EBF2FF;" collapsible="true">
    	<form id="myform" name="myform" method="post">
			<table >
		  					 <tr>
		  						<td class="td_label"  width="11%">操作员工号</td>
		  						<td  width="20%"><input type="text" name="operatorID" id="operatorID" class="input" maxlength='7' /></td>
		  						<td class="td_label"  width="11%">操作员姓名</td>
		  						<td><input type="text" name="operatorName" id="operatorName" class="input" />
		  						<a href="javascript:void(0)"  class="easyui-linkbutton" iconCls="icon-search"  onclick="serachQuery()">查询</a>
		  						</td>
		 					 </tr>
		 				
		 	</table>
		 </form>
	  	</div>
		<div id="birt" class="easyui-panel"  title="查询结果" style="background-color:#EBF2FF;height: 460"  collapsible="true">
		<div id="buttonDiv">
       <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="goAddPage()">增加</a>    
       <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editOper();">修改</a>
       <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" plain="true" onclick="delOper();">注销</a>
       <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" plain="true" onclick="editPwd();">密码修改</a>   
       </div> 
		 <table id="tb" class="easyui-datagrid"  style="width:auto;height:400px;overflow:auto"
			  url="operAction!selectOpByON.action"  toolbar="#buttonDiv" data-options="rownumbers:true,singleSelect:true,pagination:true">			
		<thead>
		  <tr> 
			    <th data-options="field:'ck',width:50,checkbox:true"></th> 
				<th data-options="field:'operatorID',width:130,align:'center'">操作员工号</th>
				<th data-options="field:'operatorName',width:180,align:'center'">操作员姓名</th>
				<th data-options="field:'posName',width:180,align:'center'">所属机构</th>
				<th data-options="field:'spare2',width:170,align:'center',
				  formatter: function(value,row,index){
				                               if (row.spare2==4){
					                                         return '票据管理员';
			                                  	} else if(row.spare2==5) {
				                                         	 return '普通操理员';
			                                    }}
				
				">权限</th>
				<th data-options="field:'registerTime_str',width:170,align:'center'">注册时间</th>
				<th data-options="field:'lastLoginTime_str',width:180,align:'center'">最后登录时间</th>		
			</tr>
		</thead>
   </table>
   </div>
	</body>
</html>
